package io.afu.nginxhelper.dto.http;

import io.afu.nginxhelper.constant.NgxConst;

public class Brotli {
    public final String KEY = "brotli";

    public final static String ENABLE = "on";

    public final static String DISABLE = "off";

    private boolean enable;

    private String brotliCompLevel;

    private String BROTLI_COMP_LEVEL = "brotli_comp_level";

    private String BROTLI_BUFFERS = "brotli_buffers";
    private String brotliBuffers;

    private String BROTLI_MIN_LENGTH = "brotli_min_length";
    private String brotliMinLength;

    private String BROTLI_TYPES = "brotli_types";
    private String brotliTypes;

    private String BROTLI_STATIC = "brotli_static";
    private String brotliStatic;

    private String BROTLI_WINDOW = "brotli_window";
    private String brotliWindow;

    @Override
    public String toString() {
        StringBuilder stringBuilder = new StringBuilder();
        if (enable){
            stringBuilder.append(KEY).append(NgxConst.SEP).append(Brotli.ENABLE).append(NgxConst.END_MARK);
            stringBuilder.append(BROTLI_COMP_LEVEL).append(NgxConst.SEP).append(brotliCompLevel).append(NgxConst.END_MARK);
            stringBuilder.append(BROTLI_BUFFERS).append(NgxConst.SEP).append(brotliBuffers).append(NgxConst.END_MARK);
            stringBuilder.append(BROTLI_MIN_LENGTH).append(NgxConst.SEP).append(brotliMinLength).append(NgxConst.END_MARK);
            stringBuilder.append(BROTLI_TYPES).append(NgxConst.SEP).append(brotliTypes).append(NgxConst.END_MARK);
            stringBuilder.append(BROTLI_STATIC).append(NgxConst.SEP).append(brotliStatic).append(NgxConst.END_MARK);
            stringBuilder.append(BROTLI_WINDOW).append(NgxConst.SEP).append(brotliWindow).append(NgxConst.END_MARK);
        }
        return stringBuilder.toString();
    }
}
